package com.million.staservice.strategy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author: studyboy
 * @Date: 2022/4/12  10:41
 * 配置工厂类
 */
@Service
public class TypeStrategyFactory {

    // spring容器启动会讲对应TypeStrategy下策略类都加载到此map中
    @Autowired
    Map<String, TypeStrategy> bases = new ConcurrentHashMap<>();

    public TypeStrategy getTypeStrategy (String type) {
        return bases.get(type);
    }
}
